package DMDE.model.tests;

import static org.junit.Assert.*;

import java.util.UUID;
import main.java.DMDE.model.Entity;
import main.java.DMDE.model.Project;
import main.java.DMDE.model.Diagram;

import org.junit.Before;
import org.junit.Test;

public class ProjectTestCase {

	private static final String TEST_PROJECT_NAME = "test";
	private static final String TEST_CLASS_NAME = "test";
	private static final String TEST_DIAGRAM_NAME = "test";
	private Project project;
	
	@Before
	public void setUp() {
		project = new Project(TEST_PROJECT_NAME);
	}
	
    @Test
    public void testHasNoDiagramNorEntity() {
    	assertNotNull(project.getName());
    	assertEquals(TEST_PROJECT_NAME, project.getName());
    	assertNotNull(project.getDiagrams());
    	assertNotNull(project.getEntities());
    	assertTrue(project.diagramsCount() == 0);
    	assertTrue(project.entitiesCount() == 0);
    }
    
    @Test
    public void testAddSameDiagramTwiceNotRepeated() {
    	Diagram diagram = new Diagram(TEST_DIAGRAM_NAME);
    	Diagram diagram2 = new Diagram(TEST_DIAGRAM_NAME);
    	project.addDiagram(diagram);
    	project.addDiagram(diagram2);
    	assertEquals(1, project.diagramsCount());
    }
    
    @Test
    public void testAddSameEntityTwiceNotRepeated() {
    	Entity entity = new main.java.DMDE.model.Class(TEST_CLASS_NAME, UUID.randomUUID());
    	Entity entity2 = new main.java.DMDE.model.Class(TEST_CLASS_NAME, UUID.randomUUID());
    	project.addEntity(entity);
    	project.addEntity(entity2);
    	assertEquals(1, project.entitiesCount());
    }
}
